/*
 * @Author       : 邱狮杰
 * @Date         : 2021-07-12 12:33:51
 * @LastEditTime : 2021-07-29 13:23:22
 * @FilePath     : /highorder_react/src/decorator/lifeCycle/componentDidMount.tsx
 * @Description  : 
 */


import { validatorsClass } from "../../utils/index";
export function componentDidMount<T>(value: (state: T) => void): Function {
  return (target: Function, key: string) => {
    validatorsClass(target, "property");
    Object.defineProperty(target.prototype, "componentDidMount", {
      value: value.bind(this, target.prototype.state),
    });
  };
}
